package com.zhida84.Servlet;
/**
 * 
 * @author shazhengbo sunchangxing
 *
 */
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.collections.map.HashedMap;

import net.sf.json.JSONArray;

import com.zhida84.Convert.DESJM;
import com.zhida84.Dao.ApplyDao;
import com.zhida84.Dao.RecruitDao;
import com.zhida84.Dao.ShowDetailDao;
import com.zhida84.Entity.RecruitTab;
import com.zhida84.Impl.ApplyImpl;
import com.zhida84.Impl.RecruitImpl;
import com.zhida84.Impl.ShowDetailImpl;

/**
 * Servlet implementation class myLeadServlet
 */
public class myLeadServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public myLeadServlet() {
		super();
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html;charset=GBK");
		request.setCharacterEncoding("UTF-8");
		try {
			PrintWriter out = response.getWriter();
			String strTrans = request.getParameter("strTrans");
			String array[] = strTrans.split(",");
			DESJM de = new DESJM();
			String struser = de.decrypt(array[0]);
			int userId = Integer.parseInt(struser);
			List<Map<String, String>> list = new ArrayList<Map<String, String>>();
			ShowDetailDao recruitDao=new ShowDetailImpl();
			ResultSet resultSet = recruitDao.showMsgByUserId(userId);
			while(resultSet.next()){
				Map<String, String> map = new HashMap<String, String>();
				map.put("content", resultSet.getString("contentInfo"));
				map.put("jobName", resultSet.getString("jobName"));
				list.add(map);
			}
			JSONArray ja = JSONArray.fromObject(list);
			out.print(ja);
		} catch (Exception e) {
		
		}
	}

}
